home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / amiga.programming / comp.sys.amiga.programmer_10459_000068.msg < prev    next >
Encoding:
Text File  |  1994-11-27  |  3.6 KB  |  90 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!pipex!howland.reston.ans.net!xlink.net!rz.uni-karlsruhe.de!stepsun.uni-kl.de!uklirb.informatik.uni-kl.de!feck
  3. From: feck@informatik.uni-kl.de (Christoph Feck IRZ)
  4. Subject: Re: BOOPSI Class Names
  5. Message-ID: <1994May8.165619@informatik.uni-kl.de>
  6. Sender: news@uklirb.informatik.uni-kl.de (Unix-News-System)
  7. Nntp-Posting-Host: uklira.informatik.uni-kl.de
  8. Organization: University of Kaiserslautern, Germany
  9. References: <2pu92s$mh7@lovelady.cs.utexas.edu> <CpFuCu.4qx@news.ci.ua.pt> <2qh5nu$mhs@priddy.cs.utexas.edu>
  10. Date: Sun, 8 May 1994 14:56:19 GMT
  11. Lines: 77
  12.  
  13. In article <2qh5nu$mhs@priddy.cs.utexas.edu>, mthomas@cs.utexas.edu (Mark A. Thomas) writes:
  14. > >: Another possibility is to not worry about possible conflicts.  Is anyone
  15. > >
  16. > >Yes, don't worry. If you provide the class as linkable code (please do), you
  17.  
  18. Please don't!
  19.  
  20. > >should make it unnamed, I mean to use it the programmer only have to get the
  21. > >class pointer returned by MakeClass().
  22.  
  23. > Well, my class is a library, not a linkable module.  The reason is that it
  24. > is more sensible when the gadget is used in multiple programs since only
  25. > one copy of the code is in memory, as opposed to one copy per program if
  26. > it was linkable.
  27.  
  28. The solution is simple:  Make your library have _one_ LVO (let's
  29. call it GetClass() here).  It should return a pointer to the Class
  30. which has to be used to create new objects.  This pointer has
  31. to be valid as long as the library has an OpenCount != 0 or has
  32. subclasses or subobjects.
  33.  
  34. There is actually no need bother about the names of the classes
  35. but it's the name of the library.  I'd suggest the way C= does it
  36. with datatypes and gadgets.  E.g., if you have an BOOPSI gadget
  37. class, put it in SYS:Classes/Gadgets/<name>.gadget, if you have
  38. a subclass of imageclass, the name would be SYS:Classes/Images/
  39. <name>.image etc.  If you have a _new_ class which is not subclass
  40. of an existing class (ie. a subclass of rootclass, icclass or model
  41. class :) create a new drawer in SYS:Classes/
  42.  
  43. I have e.g. classes for 24 bit display and it looks like this:
  44.  
  45. SYS:Classes/
  46.     Gadgets/
  47.         xxxx.gadget
  48.     DataTypes/
  49.         xxxx.datatype
  50.     displayclass    (subclass of icclass)
  51.     Displays/
  52.         amiga.display
  53.         picasso.display
  54.         (etc).
  55.  
  56. As for the serialclass someone mentioned:  Don't ever call a class
  57. (or library) just serialclass.  I assume the class is needed for
  58. serial device I/O.  Well, why not have a (device-independed) inter-
  59. face to data streams, and then built device depended classes on
  60. top of it?  I have a class called 'streamclass' and then I built
  61. a few subclasses:
  62.  
  63. SYS:Classes/
  64.     streamclass
  65.     Streams/
  66.         file.stream
  67.         memory.stream
  68.         device.stream
  69.         clipboard.stream
  70.             (this one is a subclass of device.stream)
  71.  
  72. Now, a serial.stream (subclass of device.stream, no need to bother
  73. with Exec IO functions etc.) would make sense.  Additional attributes
  74. and methods would need to be defined, of course (e.g. setting baud
  75. rate or whatever).
  76.  
  77. Think a bit object oriented when designing classes.  It is nearly
  78. always possible to make a 'super'class which actually doesn't do
  79. anything but sets the standard attributes and methods, so programs
  80. designed to use these attributes can also use any new subclass.
  81. Think about a parallel.stream.  It would be nearly the same code
  82. like in serial.stream.  Having a device.stream has two advantages:
  83. Space saving, and you benefit from any improvements made in the
  84. super classes.
  85.  
  86. I think that's enough for now :)
  87.  
  88. 3k// Christoph Feck, TowerSystems - BOOPSI Class Development
  89. \X/ Amiga - Intuition inside.
  90.